using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// Summary description for ProjectUtility
/// </summary>
public class ProjectUtility
{
	public ProjectUtility()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    static public SqlDataReader executeQueryReader(String query)
    {
        // Connection
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["rnfCS"].ToString());
        con.Open();

        SqlDataReader dr;

        // choose the approriate command
        String command = query;

        // Prepare command
        SqlCommand cmd = new SqlCommand();

        cmd.CommandText = command;
        cmd.Connection = con;

        // Execute query
        dr = cmd.ExecuteReader();
        
        return dr;
    }

    static public int executeInsertUpdateDelete(SqlCommand cmd)
    {
        // Connection
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["rnfCS"].ToString());
        con.Open();

        cmd.Connection = con;

        return cmd.ExecuteNonQuery();
    }
}
